import http from "@/api";

/**
 * 系统权限树形列表
 */
export const authTreeApi = (params: object) => {
    return http.get(`/auth/tree`, params);
};

/**
 * 系统菜单权限树形列表
 */
export const authMenuApi = () => {
    return http.get(`/auth/menus`);
};

/**
 * 新增权限
 * @param params
 */
export const addAuthApi = (params: object) => {
    return http.post(`/auth/add`, params);
};

/**
 * 编辑权限
 * @param params
 */
export const editAuthApi = (params: any) => {
    return http.put(`/auth/edit/${params.id}`, params);
};

/**
 * 切换权限状态
 * @param id
 */
export const changeStatusApi = (id: number) => {
    return http.put(`/auth/change_status/${id}`);
};

/**
 * 修改排序
 * @param params
 */
export const changeSortApi = (params: object) => {
    return http.post(`/auth/changeSort`, params);
};

/**
 * 删除权限
 * @param id
 */
export const deleteAuthByIdApi = (id: number) => {
    return http.delete(`/auth/delete/${id}`);
};

/**
 * 批量删除
 * @param params
 */
export const deleteAuthApi = (params: object) => {
    return http.post(`/auth/delete`, params);
};
